#ifndef REGISTRATION_H
#define REGISTRATION_H

#include <QFile>
#include <QMap>
#include <QWidget>

namespace Ui {
class Registration;
}

class Registration : public QWidget
{
    Q_OBJECT

public:
    explicit Registration(QWidget *parent = nullptr);
    ~Registration();

    bool isUserPwd(QString name, QString pwd); // 判断用户密码是否正确
signals:
    void registToLogin();
private slots:
    void on_surePushButton_clicked();

    void on_cancelPushButton_clicked();

private:
    Ui::Registration *ui;
    QString userName; // 记录用户名
    QString password; // 记录密码
    QList<QMap<QString, QString>> users; // 记录用户信息
    QString dataFileName = "./user.json";

    void writeUsers();
};

#endif // REGISTRATION_H
